package com.deyuanyun.pic.ctrl.enumeration;

/**
 *  任务结束方式枚举
 *  @author axiao(xj08.dream@gmail.com)
 *  @date 2016-09-07
 *  @version 1.0
 *  Histroy: [修改人][时间][描述]
 */
public enum  PlanEndMode {
    FOREVER,//从不
    COUNT, //次数
    DATE; //时间

    /**
     * 根据枚举字符串获取到枚举，取不到的时候默认为“从不”
     * @param str
     * @return
     */
    public static PlanEndMode getInstance(String str) {
        PlanEndMode[] planEndModes = PlanEndMode.values();
        for (PlanEndMode planEndMode : planEndModes) {
            if(planEndMode.name().equals(str)) {
                return planEndMode;
            }
        }
        return PlanEndMode.FOREVER;
    }
}
